<?php
    session_start();    

    if(isset($_SESSION['username']))
    {
        header('Location: files.php');
    }
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Index</title>
    </head>
    <body>
        <?php
            if(isset($_SESSION['message']))
            {
                echo $_SESSION['message'];
            }
            unset($_SESSION['message']);
        ?>
        <form method="post" action="login.php">
            <div>Please, type your username and password (you can use the default values set in the homework)</div>
            Username: <input type="text" name="username" /><br>
            Password: <input type="password" name="password" /><br>
            <input type="submit" value="Login" />
        </form>
        <div><a href="registerForm.php">Register new user</a></div>
    </body>
</html>
